<?php require_once '../yubiphpbase/appinclude.php'; 

if (! $devMode && $_SERVER['SERVER_PORT'] == 80) { 
    header('Location: https://api.yubico.com/yms');
    exit;
}

include 'head.htm';
$bgc = ' bgcolor=#ffe4b5';
$tab = getTab();
?>

<head>
<title>Yubikey Management System</title>
<link rel="stylesheet" type="text/css" href="ajaxtabs/ajaxtabs.css" />
<script type="text/javascript" src="ajaxtabs/ajaxtabs.js"></script>
</head>

<div id="container">

<?php
include 'header.php';
$alert = getAlert();
?>


<?php if (!$loggedIn): ?>
<body onload="focusInput();">
<?php endif; ?>

<!-- content landing -->
<div class="container_landing">

<?php 
if (isset($announcement) && strlen($announcement) > 0) {
	showAlert($announcement);
} else {
	showAlert($alert);
} 
if (!$loggedIn) {
	echo '<font size=1>&nbsp;</font>';
}
?>

<?php if (!$loggedIn): ?>

<div align=center id="R">
<form method=post id=loginbykey name=loginbykey action=yubi_login.php autocomplete=off>

<table>

<tr><td>
<span class="headerText">
Place the cursor in the input box, touch the YubiKey button to log in:
</span>
<p>
<input name=otp size=70 maxlength=300 class=y_input></form>

</td></tr>

<tr><td align=center><font size=2>
<!--Not registered yet? <a href=signup.php>Register here >></a> -->
</td></tr>

</table>
</div>

<?php else: ?>

<div class="infocontainer">

<center>

<!-- tabs -->
<ul id="maintab" class="shadetabs">
<li><a href="iframe_all_keys.php" rel="ajaxcontentarea">Yubikeys</a></li>
<li><a href="import_keys.php" rel="ajaxcontentarea">Add New Yubikeys</a></li>
<li><a href="yubi_mgmt.php" rel="ajaxcontentarea">My Admin Yubikeys</a></li>
<?php if (isRootAdm()): ?>
<li><a href="add_client.php" rel="ajaxcontentarea">Add Client Admin</a></li>
<?php else: ?>
<li><a href="sub_client.php" rel="ajaxcontentarea">Add Client Admin</a></li>
<?php endif; ?>

<?php if (isRootAdm()): ?>
<li><a href="iframe_all_clients.php" rel="ajaxcontentarea">Clients</a></li>
<?php endif; ?>

</ul>

<div id="ajaxcontentarea" class="contentstyle">
<script type="text/javascript">
<?php echo "expandtab('maintab', $tab); "; ?>
</script>
</div>

<!-- show content under the tab -->
<script type="text/javascript">
//Start Ajax tabs script for UL with id="maintab" 
startajaxtabs("maintab")
</script>

</center>

</div>

<?php endif; ?>
	
</div><!-- end content landing -->

<?php include 'foot.php' ?>

</div><!-- end landing container -->
</div><!-- end container -->

</body>
</html>
